<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0039)http://sns.byr.edu.cn/cp.php?ac=profile -->
<html xmlns="http://www.w3.org/1999/xhtml" ><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta http-equiv="x-ua-compatible" content="ie=7">
<title>完善基本信息</title>
<script language="javascript" type="text/javascript" src="css/makeup/script_cookie.js"></script>
<script language="javascript" type="text/javascript" src="css/makeup/script_common.js"></script>
<script language="javascript" type="text/javascript" src="css/makeup/script_menu.js"></script>
<script language="javascript" type="text/javascript" src="css/makeup/script_ajax.js"></script>
<script language="javascript" type="text/javascript" src="css/makeup/script_face.js"></script>
<script language="javascript" type="text/javascript" src="css/makeup/script_manage.js"></script>

<link rel="shortcut icon" href="http://sns.byr.edu.cn/image/favicon.ico">
<link rel="edituri" type="application/rsd+xml" title="rsd" href="http://sns.byr.edu.cn/xmlrpc.php?rsd=7679">
<link href="css/bootstrapmin.css" rel="stylesheet" media="screen">
  <link href="css/style.css" rel="stylesheet">
  
<link rel="icon" href="" type="image/x-icon" />
<link rel="shortcut icon" href="" type="image/x-icon" />

  
</head>

<body id="bg-img">
	
	<?php
		require("header.php");
	?>
<!-- end of header -->

<div id= "achievement">
<?php
	require("DBops.php");
	session_start();
	$con = connect("localhost", "root", "", "lab");
	$result = query($con, "*", "personalinfo", "ID", $_SESSION['user']);
	$row = mysql_fetch_array($result);
	$ID=$_GET['id'];
	$result = query($con, "*", "personalinfo", "ID", $ID);
	$row = mysql_fetch_array($result);
	
	/*if(isset($_SESSION['user']))
	{
		echo "<div style='height:30px;background:#A4D3EE;'>
		      
              <p  style='margin-right:10px;float:right;'>登录为: <a href = \"infor.php?id=".$_SESSION['user']."\">".$_SESSION['user']."</a></font>&nbsp&nbsp<a  onclick=\"if(confirm('确定要退出系统吗?')){parent.location.href ='login.php'}\" href=\"javascript:void(0)\">退出</a></font></p></div>";
	}
	else
	{
		$_SESSION['userurl'] = $_SERVER['REQUEST_URI']; 
		echo "<div style='height:30px;background:#A4D3EE;'>
				<ul>
              <li  style='margin-right:100px;float:right;'><a href ='login.php'>登录</a></div>";
	}*/
	require("logheader.php");
	echo"
	<div id='infor'>
	<p class='title'><img src='css/makeup/profile.gif' style='width:24px;height:24px;' >个人设置</img></p>
	<div class='tabs_header'>
	 <ul class='tabs'>
		<li class='active'><a href='Makeup.php?id=$ID'><span>基本资料</span></a></li>
		<li>&nbsp;&nbsp;<a href='Photo.php?id=$ID'><span>我的头像</span></a></li>

	</ul>
</div>
	<form method='post' action='saveditPsd.php?id=$ID'>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>登录密码修改</b>
<br/><br/>
<hr>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;密码修改后，您需要重新登录一次<br/><br/>
<table cellspacing='10' cellpadding='10' class='formtable' border='0' style='width:650px;'>
<tbody>
	<tr>
		<th style='100px;'>用户名:</th>
		<td>		
			".$row['ID']."	
		</td>
	<tr/>
</tr>
<tr></tr>
<tr>
<th style='width:10em'>当前密码:</th>
<td><input type='password' id='password' name='password' value='' onBlur='check()' /><span id ='passwords'></span>
	
</td>
<td>&nbsp;</td>
</tr>
<tr>
<th style=\"width:10em;\">新密码:</th>
<td>
<input type='password' id='password1' name='password1' value='' onBlur='check()' /><span id ='password1s'></span>
                          
</td>

</tr>
<tr>
<th style=\"width:10em;\">确认新密码:</th>

<td><input type='password' id='password2' name='password2' value='' onBlur='check()' /><span id ='password2s'></span>
		  		          
		 
</td>
<td>&nbsp;</td>
</tr>

<input type='hidden' id='getoldPsd' value='".$row['password']."'>

<tr><br/>
<th style=\"width:10em;\">&nbsp;</th>
<td>

<input type=\"submit\" name=\"submit\" value=\"修改密码\" >
</td>
<td>&nbsp;</td>
</tr>
</tbody></table>

</form>

	";
?>

<script type="text/javascript">
function oldPsd()
				{
		     	   var oldPsd = document.getElementById("password").value;  //旧密码
		     	   var getoldPsd = document.getElementById("getoldPsd").value;
				  // alert(getoldPsd);
				  // alert("1111");
		     	   //var reg= /^\d{11}$/;   //
				  // alert(oldPsd);
				   if(oldPsd==""){
				    document.getElementById("passwords").innerHTML = "<font color='red'>当前密码不能为空</font>";
								   return false;
				   }
				   if(oldPsd !="")
				   {
						   if(oldPsd!=getoldPsd){
		     	   				  document.getElementById("passwords").innerHTML = "<font color='red'>当前密码不正确</font>";
								   return false;
		     					  }
							 else {
									 document.getElementById("passwords").innerHTML = "<font color='green'>密码输入正确</font>";
									  return true;
									  }
				   }
		     	  }
		     	   
		     	   
		     	  function newPsd()
				  {
		     	   var newPsd = document.getElementById("password1").value;  //新密码
		     	  
					
                       // var e=/^\w+([-+.]\w+)* At \w+([-.]\\w+)*\.\w+([-.]\w+)*$/;
						if(newPsd=="")
						{
						 document.getElementById("password1s").innerHTML = "<font color='red'>请输入新密码</font>" ;		
								    return false;
						}
						if(newPsd !="")
						{
							if(newPsd.length<6){
							 document.getElementById("password1s").innerHTML = "<font color='red'>密码至少六位</font>" ;		
							  return false;
							}
							else{
						
									document.getElementById("password1s").innerHTML = "<font color='green'></font>";		
									 return true;
							}
						}
						}
					  
		     	  function newPsd1()
				  {
		     	   var newPsd1 = document.getElementById("password2").value;  //email邮箱
		     	    //alert(email);
					//邮箱验证
                       // var e=/^\w+([-+.]\w+)* At \w+([-.]\\w+)*\.\w+([-.]\w+)*$/;
					   var newPsd2 = document.getElementById("password1").value;
						if(newPsd1=="")
						{
						 document.getElementById("password2s").innerHTML = "<font color='red'>请确认新密码</font>" ;		
								    return false;
						}
						if(newPsd1 !="")
						{
							if(newPsd1.length<6){
							 document.getElementById("password2s").innerHTML = "<font color='red'>密码至少六位</font>" ;		
							  return false;
							}
							else {
							if(newPsd1!=newPsd2){
						
									document.getElementById("password2s").innerHTML = "<font color='green'>两次输入密码不同</font>";		
									 return false;
							}
							else {
								document.getElementById("password2s").innerHTML = "<font color='green'>密码已确认</font>";
								return true;
							}
						}}
						}
		     	   function check(){
                if (oldPsd()&&newPsd()&&newPsd1()) {
                    return true;
                }
                else {
                    return false;
                }
            }
		     	     	   




</script>

</div>

<!--/mainarea-->

<!--/wrap-->








</body></html>
